﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	x:Class="Ec2BootstrapperGUI.InstanceLauncher"
	x:Name="Window"
	Title="DialogBox_LaunchiInstanceStep2"
	FontSize="11"
    xmlns:src="clr-namespace:Ec2BootstrapperGUI"
	Width="Auto" Height="Auto" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}" Foreground="#FFFFFFFF" ResizeMode="CanResize" SizeToContent="WidthAndHeight" MinHeight="480" MinWidth="640" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">

    <Grid x:Name="LayoutRoot">
        <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" RadiusX="8" RadiusY="8" Margin="8" x:Name="bkgBaseContent" Fill="{DynamicResource WindowBackgroundFill}" Stroke="{DynamicResource WindowBackgroundFill}" BitmapEffect="{DynamicResource WindowOuterGlow}"/>
        <Rectangle Fill="{DynamicResource WindowTitleBarGloss}" Stroke="{x:Null}" RadiusX="8" RadiusY="8" HorizontalAlignment="Stretch" Margin="11,11,11,0" x:Name="TitleBarGloss" VerticalAlignment="Top" Width="Auto" Height="30" Cursor="Hand" MouseLeftButtonDown="TitleBarGloss_MouseLeftButtonDown"/>
        <DockPanel HorizontalAlignment="Stretch" Margin="14,8,14,0" VerticalAlignment="Top" Height="35" x:Name="TitleBarContainer">
            <Canvas Width="26" Height="26" x:Name="Logo" HorizontalAlignment="Left" VerticalAlignment="Center">
                <Path Fill="#fff94a00" Data="F1 M 19.752,24.648 L 18.578,17.983 L 13.303,13.732 L 14.484,20.346 L 19.752,24.648 Z"/>
                <Path Opacity="0.9" Fill="#fff94a00" Data="F1 M 9.510,26.000 L 13.400,20.457 L 12.682,13.727 L 8.832,19.236 L 9.510,26.000 Z"/>
                <Path Opacity="0.7" Fill="#fff94a00" Data="F1 M 1.361,19.716 L 8.035,18.543 L 12.293,13.276 L 5.670,14.455 L 1.361,19.716 Z"/>
                <Path Opacity="0.6" Fill="#fff94a00" Data="F1 M 0.000,9.525 L 5.551,13.410 L 12.291,12.690 L 6.773,8.848 L 0.000,9.525 Z"/>
                <Path Opacity="0.5" Fill="#fff94a00" Data="F1 M 6.332,1.313 L 7.410,7.994 L 12.623,12.320 L 11.539,5.691 L 6.332,1.313 Z"/>
                <Path Opacity="0.4" Fill="#fff94a00" Data="F1 M 16.459,0.000 L 12.568,5.542 L 13.289,12.271 L 17.137,6.762 L 16.459,0.000 Z"/>
                <Path Opacity="0.3" Fill="#fff94a00" Data="F1 M 24.639,6.244 L 17.963,7.417 L 13.705,12.684 L 20.328,11.505 L 24.639,6.244 Z"/>
                <Path Opacity="0.1" Fill="#fff94a00" Data="F1 M 26.000,16.434 L 20.449,12.551 L 13.709,13.269 L 19.227,17.111 L 26.000,16.434 Z"/>
            </Canvas>
            <TextBlock Text="EC2 Bootstrapper" TextWrapping="Wrap" FontFamily="./Fonts/#Franklin Gothic" FontSize="14" Foreground="#FFFA4B00" Width="120" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3,0,0,0" x:Name="Title"/>
            <Button Style="{StaticResource WindowButton}" x:Name="btnClose" Width="26" Height="35" DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Top" Click="backButton_Click">
                <Path StrokeThickness="0.4" Stroke="#ffbe6d15" StrokeMiterLimit="1.0" Fill="#ffffffff" Data="F1 M 11.750,10.008 L 7.813,6.099 L 11.670,2.270 C 12.109,1.833 12.109,1.125 11.670,0.689 C 11.230,0.253 10.518,0.253 10.078,0.689 L 6.222,4.519 L 2.201,0.525 C 1.761,0.089 1.049,0.089 0.609,0.525 C 0.170,0.961 0.170,1.669 0.609,2.105 L 4.631,6.099 L 0.528,10.172 C 0.088,10.608 0.088,11.315 0.528,11.752 C 0.748,11.970 1.036,12.080 1.324,12.080 C 1.612,12.080 1.899,11.970 2.120,11.752 L 6.222,7.679 L 10.158,11.588 C 10.379,11.807 10.667,11.916 10.955,11.916 C 11.242,11.916 11.531,11.807 11.750,11.588 C 12.190,11.152 12.190,10.444 11.750,10.008 Z" HorizontalAlignment="Center" VerticalAlignment="Center"/>
            </Button>
        </DockPanel>
        <TextBlock HorizontalAlignment="Left" Margin="41,50,0,0" VerticalAlignment="Top" FontFamily="./Fonts/#Franklin Gothic" FontSize="24" FontStretch="Condensed" Text="Launch Instance Step 2 of 2" TextWrapping="Wrap" x:Name="DialogBoxTitle" />
        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" x:Name="ContentContainer" Background="{x:Null}" Margin="16,80,16,32">
            <Rectangle Fill="{DynamicResource ContentBackgroundFill}" Stroke="{DynamicResource ContentContainerBackgroundStroke}" RadiusX="8" RadiusY="8" HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Width="Auto" Height="Auto" x:Name="bkgContent"/>

            <!-- START DIALOGBOX CONTENT PANEL -->
            <DockPanel HorizontalAlignment="Stretch" Margin="24,36,24,24" x:Name="Launchi_Instance_Step2" VerticalAlignment="Stretch" Width="560" Height="Auto" Background="{x:Null}">

                <TextBlock Text="Finish this form and then click the Launch button." TextWrapping="Wrap" Width="Auto" Height="Auto" DockPanel.Dock="Top" Margin="0,0,0,16"/>

                <GroupBox Margin="0,0,0,24" BorderBrush="{x:Null}" BorderThickness="1,1,1,1" Padding="8,8,8,8" DockPanel.Dock="Top" Header="Note" Style="{DynamicResource GroupBoxStyle}" Content="Leave these fields unchanged if you're unsure." Background="#33565656" />
                <Grid VerticalAlignment="Top" Width="450" Height="Auto" DockPanel.Dock="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.2*"/>
                        <ColumnDefinition Width="11" />
                        <ColumnDefinition Width="0.8*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition Height="11"/>
                        <RowDefinition />
                        <RowDefinition Height="11"/>
                        <RowDefinition />
                        <RowDefinition Height="11"/>
                        <RowDefinition />
                        <RowDefinition Height="11"/>
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <TextBlock Text="AMI Name: " TextWrapping="Wrap" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" />
                    <TextBlock Text="Instance Type: " TextWrapping="Wrap" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right" />
                    <TextBlock Text="Key Pair Name" TextWrapping="Wrap" Grid.Row="4" Grid.Column="0" HorizontalAlignment="Right" />
                    <TextBlock Text="Security Groups" TextWrapping="Wrap" Grid.Row="6" Grid.Column="0" HorizontalAlignment="Right" />
                    <TextBlock Text="Availability Zone" TextWrapping="Wrap" Grid.Row="8" Grid.Column="0" HorizontalAlignment="Right" />
                    <TextBlock Name="AmiIdLb" Text="ami-061b4d09" TextWrapping="Wrap" Grid.Row="0" Grid.Column="2"/>
                    <StackPanel  Grid.Row="2" Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Left">
                        <RadioButton Name="smallInst" Click="small_Click" Style="{DynamicResource RadioButtonStyle}" IsChecked="True" Content="Small (m1.small)" Foreground="#FFFFFFFF" Margin="0,0,16,0"/>
                        <RadioButton Name="mediumInst" Click="medium_Click" Style="{DynamicResource RadioButtonStyle}" Content="High-CPU Medium(c1.medium)" Foreground="#FFFFFFFF"/>
                    </StackPanel>
                    <ComboBox Name="KeyPairComb" SelectionChanged="KeyPairComb_SelectionChanged"
                              Width="350" Style="{DynamicResource ComboBoxStyle}" 
                              VerticalAlignment="Top" IsSynchronizedWithCurrentItem="True" Grid.Row="4" Grid.Column="2" 
                              ScrollViewer.CanContentScroll="False" HorizontalAlignment="Left" 
                              ItemContainerStyle="{DynamicResource ComboBoxItemStyle}"
                              ItemsSource="{Binding Path=keyPairs, RelativeSource={RelativeSource AncestorType={x:Type src:InstanceLauncher}}, Mode=OneWay}" />
                    <ComboBox Name="SecurityGroupComb" Width="350"
                              Style="{DynamicResource ComboBoxStyle}" VerticalAlignment="Top" 
                              IsSynchronizedWithCurrentItem="True" Grid.Row="6" Grid.Column="2"
                              ScrollViewer.CanContentScroll="False" HorizontalAlignment="Left"
                              ItemContainerStyle="{DynamicResource ComboBoxItemStyle}"
                              ItemsSource="{Binding Path=securityGroups, RelativeSource={RelativeSource AncestorType={x:Type src:InstanceLauncher}}, Mode=OneWay}" />
                    <ComboBox Name="ZoneComb" Width="350" Style="{DynamicResource ComboBoxStyle}" VerticalAlignment="Top"
                              IsSynchronizedWithCurrentItem="True" Grid.Row="8" Grid.Column="2" 
                              ScrollViewer.CanContentScroll="False" HorizontalAlignment="Left"
                              ItemContainerStyle="{DynamicResource ComboBoxItemStyle}"
                              ItemsSource="{Binding Path=zones, RelativeSource={RelativeSource AncestorType={x:Type src:InstanceLauncher}}, Mode=OneWay}"/>
                </Grid>

                <GroupBox Margin="0,24,0,16" BorderBrush="{x:Null}" BorderThickness="1,1,1,1" Padding="8,8,8,8" DockPanel.Dock="Top" Header="Note" Style="{DynamicResource GroupBoxStyle}" Background="#33565656">
                    <TextBlock TextWrapping="Wrap">You will be charged the hourly rate for any instances you launch until you shut them down. After you click Launch, close this dialog box and check the status on the main page.</TextBlock>
                </GroupBox>

                <StackPanel Orientation="Horizontal" Height="30" DockPanel.Dock="Bottom" HorizontalAlignment="Right" Margin="0,0,0,0">
                    <Button Style="{DynamicResource ButtonStyle}" Name="BackButton"  Content="Back"  Click="backButton_Click" Margin="0,0,24,0" />
                    <Button Style="{DynamicResource ButtonStyle}" Name="LaunchButton" Content="Launch" Click="launchButton_Click" IsEnabled="True" />
                </StackPanel>

            </DockPanel>
            <!--END START DIALOGBOX CONTENT PANEL -->

        </Grid>
        <StatusBar HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="Auto" Height="Auto" Background="{x:Null}" Foreground="#FFFFFFFF" BorderBrush="{x:Null}" Margin="0,0,24,10">
            <TextBlock Name="StatusDesc" HorizontalAlignment="Left" VerticalAlignment="Top" Text="Launching instance..." TextWrapping="Wrap" FontSize="11" Margin="0,0,8,0"/>
            <ProgressBar Name="LaunchProgBar" HorizontalAlignment="Left" VerticalAlignment="Top" Width="200" Height="15" Value="50"/>
        </StatusBar>

    </Grid>
</Window>